<div id="network-supply-transport-bar3" style="height: 100%">

</div>

<script type="text/javascript">
    function loadbar3(branchCenter,primarySale) {
        $.ajax({
            url: "#springUrl('/network/supply/transport/bar1')",
            data: { branchCenter: branchCenter, primarySale: primarySale},
            type: "POST",
            success: function (text) {
                var d = JSON.parse(text);
                if (d.success && d.data) {
                    var myChart = echarts.init(document.getElementById('network-supply-transport-bar3'), 'macarons');
                    myChart.setOption({
                        title: {
                            text: '一天内所有车辆总油耗：元'
                            , show: false
                        },
                        tooltip: {
                            trigger: 'axis',
                            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                            }
                        },
                        grid:{
                            x:50,
                            y:20,
                            x2:20,
                            y2:35, borderWidth:10
                        },
                        toolbox: {
                            show: true,
                            feature: {
                                mark: {show: true},
                                saveAsImage: {show: true}
                            }
                        },
                        xAxis: [
                            {
                                type: 'category',
                                data: d.data.time,
                                axisLabel: {
                                    textStyle:{
                                        color:"#595959"
                                    }
                                },
                                axisLine: {
                                    show: false
                                },
                                axisTick: {
                                    show: false
                                },
                            }
                        ],
                        yAxis: [
                            {
                                type: 'value',
                                boundaryGap: [0, 0.1],
                                axisLine: {
                                    show: false
                                },
                                axisTick: {
                                    show: false
                                },
                                axisLabel: {
                                    formatter: function(value){
                                        var var1=value*1;
                                        return var1;
                                    },
                                    textStyle:{
                                        color:"#595959"
                                    }
                                },
                                splitLine:{
                                    show:true
                                },
                                splitArea: {
                                    show:true,
                                    areaStyle: {
                                        color: ['rgba(0,0,0,0)', 'rgba(0,0,0,0)']
                                    }
                                },
                            }
                        ],
                        series: [
                            {
                                name: '延误次数',
                                type: 'line',
                                barCategoryGap: '50%',
                                itemStyle: {
                                    normal: {
                                        color: '#4472c4',
                                        barBorderColor: '#4472c4',
                                        barBorderWidth: 6,
                                        barBorderRadius: 0
                                    }
                                },
                                label: {
                                    normal: {
                                        color: 'black',
                                        show: true,
                                        position: 'insideTop'
                                    }
                                },
                                data: d.data.ontime
                            }
                        ]
                    });
                }else{
                    var div1="<div type='text' style='padding-top:18%' class=' text-center '>"+d.message+"</div>";
                    $("#network-supply-transport-bar3").empty();
                    $("#network-supply-transport-bar3").prepend(div1);
                }
            }
        });
    }

</script>